|
|
|
|
|
|
|
Listing 9.10. Coding the cmdDBProperties_Click event. |
|
|
|
|
|
|
|
|
Private Sub cmdDBProperties_Click()
'
' show all database properties
'
On Error GoTo LocalErr
'
Dim ws As Workspace
Dim db As Database
Dim objItem As Property
'
Dim strDBName As String
Dim strMsg As String
'
' use db created earlier
strDBName = App.Path & "\CreateDBOne.mdb"
'
' open db in default ws
Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase(strDBName)
'
' enumerate all the properties of the db
strMsg = ""
For Each objItem In db.Properties
strMsg = strMsg & objItem.Name
strMsg = strMsg & " = "
strMsg = strMsg & objItem.Value
strMsg = strMsg & " {"
strMsg = strMsg & ShowType(objItem.Type) & "}"
strMsg = strMsg & vbCrLf
Next
'
MsgBox strMsg, vbInformation, "DBProperties"
strMsg = ""
Exit Sub
'
LocalErr:
strMsg = strMsg & "<err>"
Resume Next
'
End Sub |
|
|
|
|
|
|
|
|
In Listing 9.10, you opened an existing Microsoft Jet database in the default workspace (but did not explicitly declare a session). Then you enumerated the properties of the Database object. Save and run the project. Click the DBProperties button and compare your screen to the one in Figure 9.9. |
|
|
|
|
|